/*package com.zzxy.spring34.Po;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.BeanFactoryAware;
import org.springframework.beans.factory.BeanNameAware;

public class User implements BeanNameAware, BeanFactoryAware {

    private String username;

    public  String getUsername() { return username; }

    public void  setUsername(String username) {
        this.username = username;
        System.out.println("2.set properties");
    }

    public User() {
        System.out.println("1.init instance ...");
    }

    @Override
    public void setBeanName(String s) {
        System.out.println("3.set bean name ...");
    }

    @Override
    public void setBeanFactory(BeanFactory beanFactory) throws BeansException{
        System.out.println("4.set bean factory ..."+beanFactory);
    }

    @Override
    public void afterProoertiesSet() throws Exception {
        System.out.println("6.after properties");
    }

    public void myInit() {
        System.out.println("7.my init ...");
    }

    @Override
    public void destroy() throws Exception{
        System.out.println("9.destroy ...");
    }

    public void myDestroy() {
        System.out.println("10.my destroy ...");
    }

    @Override
    public void setBeanFactory(BeanFactory beanFactory) throws BeansException {

    }
}*/
package com.zzxy.spring34.Po;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.*;

public class User implements BeanNameAware, BeanFactoryAware, InitializingBean, DisposableBean {
 private String username;

 public String getUsername() {
 return username;
}

 public void setUsername(String username) {
 System.out.println("2.set username..");


 this.username = username;
 }

 public User() {
 System.out.println("1.init instance ");
 }


 public void setBeanName(String beanName) {
 System.out.println("3.bean name aware: " + beanName);
 }


 public void setBeanFactory(BeanFactory beanFactory) throws BeansException {
 System.out.println("4.set bean factory :" + beanFactory);
 }


 public void afterPropertiesSet() throws Exception {
 System.out.println("6.after properties...");
 }
 public void myInit(){
 System.out.println("7.my init function...");
 }


 public void destroy() throws Exception {
 System.out.println("9.destroy...");
 }
 public void myDestroy(){
 System.out.println("10.myDestroy...");
 }
}
